package com.transcargo.users;
import java.util.ArrayList;
import java.util.Iterator;

import com.transcargo.db.db;
import com.transcargo.db.dbException;

public class Contact {
    private int Id = -1;
    private int User_Id = -1;
    private String name = "";
    private String phone1 = "";
    private String phone2 = "";
    private String phone3 = "";
    private String email = "";
    private String icq = "";
    private String skype = "";
    private String info = "";
    private String photo = "";
    public Contact(int id, int user_id, db Db) throws dbException {
        Id = id;
        User_Id = user_id;
        ArrayList<String[]> list = Db.execute("SELECT name, phone1, phone2, phone3, email, icq, skype, info, photo FROM contacts WHERE user_id=" + Integer.toString(user_id) + " and id=" + Integer.toString(id));
        if (list != null) {
            Iterator<String[]> iter =list.iterator();
            String[] ctr = iter.next();
            name = ctr[0];
            phone1 = ctr[1];
            phone2 = ctr[2];
            phone3 = ctr[3];
            email = ctr[4];
            icq = ctr[5];
            skype = ctr[6];
            info = ctr[7];
            photo = ctr[8];
        }
     }
    public int getId() {
    	return Id;
    }
    public String getName() {
        return name;
    }
    public String getPhone1() {
        return phone1;
    }
    public String getPhone2() {
        return phone2;
    }
    public String getPhone3() {
        return phone3;
    }
    public String getEmail() {
        return email;
    }
    public String getIcq() {
        return icq;
    }
    public String getSkype() {
        return skype;
    }
    public String getInfo() {
        return info;
    }
    public String getPhoto() {
        return photo;
    }

}
